﻿
@{
    ViewBag.Title = "ConfigView";
    Layout = "~/Views/Shared/layoutCommon.cshtml";
}

@section style{
    <style type="text/css">
        .box-body table tr td label {
            float: left;
            width: 30%;
            margin-top: 8px;
        }

        .col-sm-10 {
            width: 70%;
        }
    </style>
}
<section class="content-header">
    <h1>
        @ViewBag.CityName 配置业务
        <small></small>
    </h1>
    <ol class="breadcrumb">
        <li><a href="#"><i class="fa fa-dashboard"></i>主页</a></li>
        <li><a href="@Url.Content("~/config/CityOpenManage")?provinceid=@ViewBag.ProvinceId">省市业务开通</a></li>
        <li><a href="@Url.Content("~/config/FormBusiness")?cityid=@ViewBag.CityId&provinceid=@ViewBag.ProvinceId&cityname=@ViewBag.CityName">配置业务</a></li>
        <li class="active">配置预览</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box box-primary">
                <div class="box-header">
                    <div class="bs-example">
                        <ul class="nav nav-tabs">
                            <li role="presentation"><a href="@Url.Content("~/Config/ConfigForm?provinceid="+@ViewBag.ProvinceId+"&cityname="+@ViewBag.CityName+"&cgfid="+@ViewBag.CgfId+"")">配置表单</a></li>
                            <li role="presentation"><a href="@Url.Content("~/Config/ConfigPrice?provinceid="+@ViewBag.ProvinceId+"&cityname="+@ViewBag.CityName+"&cgfid="+@ViewBag.CgfId+"")">配置价格</a></li>
                            <li role="presentation"><a href="@Url.Content("~/Config/ConfigOrderExpire?provinceid="+@ViewBag.ProvinceId+"&cityname="+@ViewBag.CityName+"&cgfid="+@ViewBag.CgfId+"")">网办订单过期</a></li>
                            <li role="presentation"><a href="@Url.Content("~/Config/ConfigGuidance?provinceid="+@ViewBag.ProvinceId+"&cityname="+@ViewBag.CityName+"&cgfid="+@ViewBag.CgfId+"")">配置说明</a></li>
                            <li role="presentation">
                                <a href="@Url.Content("~/Config/ConfigExpressTemplate?provinceid="+@ViewBag.ProvinceId+"&cityname="+@ViewBag.CityName+"&cgfid="+@ViewBag.CgfId+"&bizTypeId="+@ViewBag.BizTypeId)">配置快递</a>
                            </li>
                            <li role="presentation" class="active"><a href="#">配置预览</a></li>
                        </ul>
                    </div>

                    <h3>
                        <i class="fa fa-fw fa-arrow-right"></i>@ViewBag.BizTypeName
                    </h3>
                </div>
                <!-- /.box-header -->
                <div class="box-body table-responsive no-padding">
                    <table class="table table-hover body-table-head">
                        <colgroup>
                            <col style="width:5%" />
                            <col style="width:30%" />
                            <col style="width:20%" />
                            <col style="width:35%" />
                        </colgroup>
                        <tbody id="tbodylist"></tbody>
                    </table>
                </div>
                <div class="box-footer text-center">
                    <button class="btn" type="button" id="btnCancel">取 消 </button>
                </div>
                <!-- /.box-body -->
                <!-- /.box -->
            </div>
        </div>
    </div>
</section>

@section scriptsBottom{
    <script src="@Url.Content("~/lib/art-template/template-web.js")"></script>
    <script id="dataItemTpl" type="text/html">
        {{each data.FormFieldList}}
        <tr>
            <td></td>
            <td>
                <label>{{$value.FieldDesc}}:</label>
                <div class="col-sm-10">
                    {{if $value.FieldType=='textbox'}}
                    <input type="text" class="form-control" style="width:150px;" />
                    {{else if $value.FieldType=='textaddon'}}
                    <div class="input-group">
                        <div class="input-group-btn">
                            <button type="button" class="btn btn-primary">京</button>
                        </div>
                        <!-- /btn-group -->
                        <input type="text" class="form-control" style="width:110px;">
                    </div>
                    {{else if $value.FieldType=='checkbox'}}
                    <label>
                        <input type="checkbox" checked="checked">
                        选择
                    </label>
                    {{else if $value.FieldType=='fileupload'}}
                    <img class="img-thumbnail" style="width: 60px; height: 35px;background-color:#ddd">
                    {{else if $value.FieldType=='jumppage'}}
                    <div style="margin-top:7px;">文本信息</div>
                    {{/if}}
                </div>
            </td>
            <td></td>
            <td></td>
        </tr>
        {{/each}}
        {{each data.ExpressList}}
        <tr>
            <td></td>
            <td>
                <div style="width:50px; float:left; margin-top:15px;">
                    <input type="checkbox" />
                    </div>
                <div style="width:150px; float:left;">
                    <img src="{{$value.Logo}}" style="width:100px;height:50px;">
                    </div>
                <div style="width:150px; float:left;margin-top:15px;">
                    {{$value.CompanyName}}
                    </div>
</td>
            <td></td>
            <td></td>
        </tr>
        {{/each}}
        {{each data.FeeList}}
        <tr>
            <td></td>
            <td>
                <div style="width:150px; float:left;">{{$value.FeeName}}</div> 
                <div style="color:red; font-weight:bold; float:left;">￥{{$value.Fee}}</div>
            </td>
            <td></td>
            <td></td>
        </tr>
        {{/each}}
    </script>
    <script type="text/javascript">
        $(document).ready(function () {
            bindFormField();
            $("#btnCancel").click(function () {
                cancel();
            });
        });

        //字段绑定
        function bindFormField()
        {
            BMCW.ajax({
                url: "@Url.Content("~/Config/GetFormFieldListSort")?cfgId=@ViewBag.CgfId&cityId=@ViewBag.CityId&bizTypeId=@ViewBag.BizTypeId",
                type: "Get",
                success: function (o) {
                    if (o.status == 0) {
                        if (o.data.length < 1) {
                            $("#nodata").show();
                            document.getElementById('tbodylist').innerHTML = "";
                            return;
                        }
                        $("#nodata").hide();
                        var html = template('dataItemTpl', o);
                        document.getElementById('tbodylist').innerHTML = html;
                        
                    } else {
                        $("#nodata").show();
                        document.getElementById('tbodylist').innerHTML = "";
                    }
                }
            });
        }

        //取消，跳回上一页面
        function cancel()
        {
            history.go(-1);
        }
    </script>
}

